Repetier-Firmware  1.0.0
Communication.h
Go to the documentation of this file.
1 /*
2  This file is part of Repetier-Firmware.
3 
4  Repetier-Firmware is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  Repetier-Firmware is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with Repetier-Firmware. If not, see <http://www.gnu.org/licenses/>.
16 
17  This firmware is a nearly complete rewrite of the sprinter firmware
18  by kliment (https://github.com/kliment/Sprinter)
19  which based on Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.
20 */
21 
22 #ifndef COMMUNICATION_H
23 #define COMMUNICATION_H
24 
25 #ifndef MAX_DATA_SOURCES
26 #define MAX_DATA_SOURCES 4
27 #endif
28 
40 class GCodeSource {
45  public:
47  static void registerSource(GCodeSource *newSource);
48  static void removeSource(GCodeSource *delSource);
49  static void rotateSource();
50  static void writeToAll(uint8_t byte);
51  static void printAllFLN(FSTRINGPARAM(text) );
52  static void printAllFLN(FSTRINGPARAM(text), int32_t v);
53  uint32_t lastLineNumber;
57 
58  GCodeSource();
59  virtual ~GCodeSource() {}
60  virtual bool isOpen() = 0;
61  virtual bool supportsWrite() = 0;
62  virtual bool closeOnError() = 0; // return true if the channel can not interactively correct errors.
63  virtual bool dataAvailable() = 0; // would read return a new byte?
64  virtual int readByte() = 0;
65  virtual void close() = 0;
66  virtual void writeByte(uint8_t byte) = 0;
67 };
68 
69 class Com
70 {
71  public:
72 FSTRINGVAR(tDebug)
73 FSTRINGVAR(tFirmware)
74 FSTRINGVAR(tOk)
75 FSTRINGVAR(tNewline)
76 FSTRINGVAR(tNAN)
77 FSTRINGVAR(tINF)
78 FSTRINGVAR(tError)
79 FSTRINGVAR(tInfo)
80 FSTRINGVAR(tWarning)
81 FSTRINGVAR(tResend)
82 FSTRINGVAR(tEcho)
83 FSTRINGVAR(tCap)
84 FSTRINGVAR(tOkSpace)
85 FSTRINGVAR(tWrongChecksum)
86 FSTRINGVAR(tMissingChecksum)
87 FSTRINGVAR(tFormatError)
88 FSTRINGVAR(tDonePrinting)
89 FSTRINGVAR(tX)
90 FSTRINGVAR(tY)
91 FSTRINGVAR(tZ)
92 FSTRINGVAR(tE)
93 FSTRINGVAR(tF)
94 FSTRINGVAR(tS)
95 FSTRINGVAR(tP)
96 FSTRINGVAR(tI)
97 FSTRINGVAR(tJ)
98 FSTRINGVAR(tR)
99 FSTRINGVAR(tD)
100 FSTRINGVAR(tC)
101 FSTRINGVAR(tH)
102 FSTRINGVAR(tA)
103 FSTRINGVAR(tB)
104 FSTRINGVAR(tK)
105 FSTRINGVAR(tL)
106 FSTRINGVAR(tO)
107 FSTRINGVAR(tSDReadError)
108 FSTRINGVAR(tExpectedLine)
109 FSTRINGVAR(tGot)
110 FSTRINGVAR(tSkip)
111 FSTRINGVAR(tBLK)
112 FSTRINGVAR(tStart)
113 FSTRINGVAR(tPowerUp)
114 FSTRINGVAR(tExternalReset)
115 FSTRINGVAR(tBrownOut)
116 FSTRINGVAR(tWatchdog)
117 FSTRINGVAR(tSoftwareReset)
118 FSTRINGVAR(tUnknownCommand)
119 FSTRINGVAR(tFreeRAM)
120 FSTRINGVAR(tXColon)
121 FSTRINGVAR(tSlash)
122 FSTRINGVAR(tSpaceSlash)
123 FSTRINGVAR(tFatal)
124 FSTRINGVAR(tDoorOpen)
125 #if JSON_OUTPUT
126 FSTRINGVAR(tJSONDir)
127 FSTRINGVAR(tJSONFiles)
128 FSTRINGVAR(tJSONArrayEnd)
129 FSTRINGVAR(tJSONErrorStart)
130 FSTRINGVAR(tJSONErrorEnd)
131 FSTRINGVAR(tJSONFileInfoStart)
132 FSTRINGVAR(tJSONFileInfoHeight)
133 FSTRINGVAR(tJSONFileInfoLayerHeight)
134 FSTRINGVAR(tJSONFileInfoFilament)
135 FSTRINGVAR(tJSONFileInfoGeneratedBy)
136 FSTRINGVAR(tJSONFileInfoName)
137 #endif
138 FSTRINGVAR(tSpaceXColon)
139 FSTRINGVAR(tSpaceYColon)
140 FSTRINGVAR(tSpaceZColon)
141 FSTRINGVAR(tSpaceEColon)
142 FSTRINGVAR(tTColon)
143 FSTRINGVAR(tSpaceBColon)
144 FSTRINGVAR(tSpaceAtColon)
145 FSTRINGVAR(tSpaceT)
146 FSTRINGVAR(tSpaceRaw)
147 FSTRINGVAR(tSpaceAt)
148 FSTRINGVAR(tSpaceBAtColon)
149 FSTRINGVAR(tColon)
150 FSTRINGVAR(tSpeedMultiply)
151 FSTRINGVAR(tFlowMultiply)
152 FSTRINGVAR(tFanspeed)
153 FSTRINGVAR(tFan2speed)
154 FSTRINGVAR(tPrintedFilament)
155 FSTRINGVAR(tPrintingTime)
156 FSTRINGVAR(tSpacem)
157 FSTRINGVAR(tSpaceDaysSpace)
158 FSTRINGVAR(tSpaceHoursSpace)
159 FSTRINGVAR(tSpaceMin)
160 FSTRINGVAR(tInvalidArc)
161 FSTRINGVAR(tComma)
162 FSTRINGVAR(tSpace)
163 FSTRINGVAR(tYColon)
164 FSTRINGVAR(tZColon)
165 FSTRINGVAR(tE0Colon)
166 FSTRINGVAR(tE1Colon)
167 FSTRINGVAR(tMS1MS2Pins)
168 FSTRINGVAR(tSetOutputSpace)
169 FSTRINGVAR(tGetInputSpace)
170 FSTRINGVAR(tSpaceToSpace)
171 FSTRINGVAR(tSpaceIsSpace)
172 FSTRINGVAR(tHSpace)
173 FSTRINGVAR(tLSpace)
174 FSTRINGVAR(tXMinColon)
175 FSTRINGVAR(tXMaxColon)
176 FSTRINGVAR(tYMinColon)
177 FSTRINGVAR(tYMaxColon)
178 FSTRINGVAR(tZMinColon)
179 FSTRINGVAR(tZ2MinMaxColon)
180 FSTRINGVAR(tZMaxColon)
181 FSTRINGVAR(tJerkColon)
182 FSTRINGVAR(tZJerkColon)
183 FSTRINGVAR(tLinearStepsColon)
184 FSTRINGVAR(tQuadraticStepsColon)
185 FSTRINGVAR(tCommaSpeedEqual)
186 FSTRINGVAR(tLinearLColon)
187 FSTRINGVAR(tQuadraticKColon)
188 FSTRINGVAR(tEEPROMUpdated)
189 FSTRINGVAR(tFilamentSlipping)
190 FSTRINGVAR(tPauseCommunication)
191 FSTRINGVAR(tContinueCommunication)
192 #if NONLINEAR_SYSTEM
193 FSTRINGVAR(tInvalidDeltaCoordinate)
194 FSTRINGVAR(tDBGDeltaNoMoveinDSegment)
195 #endif
196 #if DRIVE_SYSTEM == DELTA
197 FSTRINGVAR(tMeasurementReset)
198 FSTRINGVAR(tMeasureDeltaSteps)
199 FSTRINGVAR(tMeasureDelta)
200 FSTRINGVAR(tMeasureOriginReset)
201 FSTRINGVAR(tMeasurementAbortedOrigin)
202 FSTRINGVAR(tLevelingCalc)
203 FSTRINGVAR(tTower1)
204 FSTRINGVAR(tTower2)
205 FSTRINGVAR(tTower3)
206 FSTRINGVAR(tDeltaAlphaA)
207 FSTRINGVAR(tDeltaAlphaB)
208 FSTRINGVAR(tDeltaAlphaC)
209 FSTRINGVAR(tDeltaRadiusCorrectionA)
210 FSTRINGVAR(tDeltaRadiusCorrectionB)
211 FSTRINGVAR(tDeltaRadiusCorrectionC)
212 FSTRINGVAR(tDeltaDiagonalCorrectionA)
213 FSTRINGVAR(tDeltaDiagonalCorrectionB)
214 FSTRINGVAR(tDeltaDiagonalCorrectionC)
215 FSTRINGVAR(tEPRDeltaMaxRadius)
216 #endif // DRIVE_SYSTEM
217 #if DRIVE_SYSTEM==TUGA
218 FSTRINGVAR(tEPRDiagonalRodLength)
219 #endif
220 #ifdef DEBUG_GENERIC
221 FSTRINGVAR(tGenTemp)
222 #endif // DEBUG_GENERICFSTRINGVALUE(Com::,"")
223 FSTRINGVAR(tTargetExtr)
224 FSTRINGVAR(tTargetBedColon)
225 FSTRINGVAR(tPIDAutotuneStart)
226 FSTRINGVAR(tAPIDBias)
227 FSTRINGVAR(tAPIDD)
228 FSTRINGVAR(tAPIDMin)
229 FSTRINGVAR(tAPIDMax)
230 FSTRINGVAR(tAPIDKu)
231 FSTRINGVAR(tAPIDTu)
232 FSTRINGVAR(tAPIDClassic)
233 FSTRINGVAR(tAPIDSome)
234 FSTRINGVAR(tAPIDNone)
235 FSTRINGVAR(tAPIDPessen)
236 FSTRINGVAR(tAPIDKp)
237 FSTRINGVAR(tAPIDKi)
238 FSTRINGVAR(tAPIDKd)
239 FSTRINGVAR(tAPIDFailedHigh)
240 FSTRINGVAR(tAPIDFailedTimeout)
241 FSTRINGVAR(tAPIDFinished)
242 FSTRINGVAR(tMTEMPColon)
243 FSTRINGVAR(tHeatedBed)
244 FSTRINGVAR(tExtruderSpace)
245 FSTRINGVAR(tTempSensorDefect)
246 FSTRINGVAR(tTempSensorWorking)
247 FSTRINGVAR(tDryModeUntilRestart)
248 #ifdef DEBUG_QUEUE_MOVE
249 FSTRINGVAR(tDBGId)
250 FSTRINGVAR(tDBGVStartEnd)
251 FSTRINGVAR(tDBAccelSteps)
252 FSTRINGVAR(tDBGStartEndSpeed)
253 FSTRINGVAR(tDBGFlags)
254 FSTRINGVAR(tDBGJoinFlags)
255 FSTRINGVAR(tDBGDelta)
256 FSTRINGVAR(tDBGDir)
257 FSTRINGVAR(tDBGFullSpeed)
258 FSTRINGVAR(tDBGVMax)
259 FSTRINGVAR(tDBGAcceleration)
260 FSTRINGVAR(tDBGAccelerationPrim)
261 FSTRINGVAR(tDBGRemainingSteps)
262 FSTRINGVAR(tDBGAdvanceFull)
263 FSTRINGVAR(tDBGAdvanceRate)
264 FSTRINGVAR(tDBGLimitInterval)
265 FSTRINGVAR(tDBGMoveDistance)
266 FSTRINGVAR(tDBGCommandedFeedrate)
267 FSTRINGVAR(tDBGConstFullSpeedMoveTime)
268 #endif // DEBUG_QUEUE_MOVEFSTRINGVALUE(Com::,"")
269 #ifdef DEBUG_DELTA_OVERFLOW
270 FSTRINGVAR(tDBGDeltaOverflow)
271 #endif // DEBUG_DELTA_OVERFLOW
272 #ifdef DEBUG_SPLIT
273 FSTRINGVAR(tDBGDeltaSeconds)
274 FSTRINGVAR(tDBGDeltaZDelta)
275 FSTRINGVAR(tDBGDeltaSegments)
276 FSTRINGVAR(tDBGDeltaNumLines)
277 FSTRINGVAR(tDBGDeltaSegmentsPerLine)
278 FSTRINGVAR(tDBGDeltaMaxDS)
279 FSTRINGVAR(tDBGDeltaStepsPerSegment)
280 FSTRINGVAR(tDBGDeltaVirtualAxisSteps)
281 #endif
282 #ifdef DEBUG_STEPCOUNT
283 FSTRINGVAR(tDBGMissedSteps)
284 #endif
285 #if FEATURE_Z_PROBE
286 FSTRINGVAR(tZProbe)
287 FSTRINGVAR(tZProbeState)
288 FSTRINGVAR(tZProbeStartScript)
289 FSTRINGVAR(tZProbeEndScript)
290 FSTRINGVAR(tHitZProbe)
291 FSTRINGVAR(tZProbeAverage)
292 FSTRINGVAR(tZProbeZReset)
293 FSTRINGVAR(tZProbeBedDitance)
294 #endif
295 FSTRINGVAR(tAutolevelReset)
296 FSTRINGVAR(tAutolevelEnabled)
297 FSTRINGVAR(tAutolevelDisabled)
298 FSTRINGVAR(tTransformationMatrix)
299 FSTRINGVAR(tZProbeFailed)
300 FSTRINGVAR(tZProbeMax)
301 FSTRINGVAR(tZProbePrinterHeight)
302 
303 #ifdef WAITING_IDENTIFIER
304 FSTRINGVAR(tWait)
305 #endif // WAITING_IDENTIFIER
306 
307 #if EEPROM_MODE==0
308 FSTRINGVAR(tNoEEPROMSupport)
309 #else
310 FSTRINGVAR(tZProbeOffsetZ)
311 #if FEATURE_Z_PROBE
312 FSTRINGVAR(tZProbeHeight)
313 FSTRINGVAR(tZProbeOffsetX)
314 FSTRINGVAR(tZProbeOffsetY)
315 FSTRINGVAR(tZProbeSpeed)
316 FSTRINGVAR(tZProbeSpeedXY)
317 FSTRINGVAR(tZProbeX1)
318 FSTRINGVAR(tZProbeY1)
319 FSTRINGVAR(tZProbeX2)
320 FSTRINGVAR(tZProbeY2)
321 FSTRINGVAR(tZProbeX3)
322 FSTRINGVAR(tZProbeY3)
323 FSTRINGVAR(zZProbeBendingCorA)
324 FSTRINGVAR(zZProbeBendingCorB)
325 FSTRINGVAR(zZProbeBendingCorC)
326 #endif
327 #if FEATURE_AUTOLEVEL
328 FSTRINGVAR(tAutolevelActive)
329 #endif
330 #if FEATURE_AXISCOMP
331 FSTRINGVAR(tAxisCompTanXY)
332 FSTRINGVAR(tAxisCompTanYZ)
333 FSTRINGVAR(tAxisCompTanXZ)
334 #endif
335 FSTRINGVAR(tConfigStoredEEPROM)
336 FSTRINGVAR(tConfigLoadedEEPROM)
337 FSTRINGVAR(tEPRConfigResetDefaults)
338 FSTRINGVAR(tEPRProtocolChanged)
339 FSTRINGVAR(tEPR0)
340 FSTRINGVAR(tEPR1)
341 FSTRINGVAR(tEPR2)
342 FSTRINGVAR(tEPR3)
343 FSTRINGVAR(tLanguage)
344 FSTRINGVAR(tEPRBaudrate)
345 FSTRINGVAR(tEPRFilamentPrinted)
346 FSTRINGVAR(tEPRPrinterActive)
347 FSTRINGVAR(tEPRMaxInactiveTime)
348 FSTRINGVAR(tEPRStopAfterInactivty)
349 FSTRINGVAR(tEPRMaxJerk)
350 FSTRINGVAR(tEPRXHomePos)
351 FSTRINGVAR(tEPRYHomePos)
352 FSTRINGVAR(tEPRZHomePos)
353 FSTRINGVAR(tEPRXMaxLength)
354 FSTRINGVAR(tEPRYMaxLength)
355 FSTRINGVAR(tEPRZMaxLength)
356 FSTRINGVAR(tEPRXBacklash)
357 FSTRINGVAR(tEPRYBacklash)
358 FSTRINGVAR(tEPRZBacklash)
359 FSTRINGVAR(tEPRZAcceleration)
360 FSTRINGVAR(tEPRZTravelAcceleration)
361 FSTRINGVAR(tEPRAccelerationFactorAtTop)
362 FSTRINGVAR(tEPRZStepsPerMM)
363 FSTRINGVAR(tEPRZMaxFeedrate)
364 FSTRINGVAR(tEPRZHomingFeedrate)
365 #if DRIVE_SYSTEM != DELTA
366 FSTRINGVAR(tEPRMaxZJerk)
367 FSTRINGVAR(tEPRXStepsPerMM)
368 #if DUAL_X_RESOLUTION
369 FSTRINGVAR(tEPRX2StepsPerMM)
370 #endif
371 FSTRINGVAR(tEPRYStepsPerMM)
372 FSTRINGVAR(tEPRXMaxFeedrate)
373 FSTRINGVAR(tEPRYMaxFeedrate)
374 FSTRINGVAR(tEPRXHomingFeedrate)
375 FSTRINGVAR(tEPRYHomingFeedrate)
376 FSTRINGVAR(tEPRXAcceleration)
377 FSTRINGVAR(tEPRYAcceleration)
378 FSTRINGVAR(tEPRXTravelAcceleration)
379 FSTRINGVAR(tEPRYTravelAcceleration)
380 #else
381 FSTRINGVAR(tEPRDiagonalRodLength)
382 FSTRINGVAR(tEPRHorizontalRadius)
383 FSTRINGVAR(tEPRTowerXOffset)
384 FSTRINGVAR(tEPRTowerYOffset)
385 FSTRINGVAR(tEPRTowerZOffset)
386 #endif
387 FSTRINGVAR(tEPROPSMode)
388 FSTRINGVAR(tEPROPSMoveAfter)
389 FSTRINGVAR(tEPROPSMinDistance)
390 FSTRINGVAR(tEPROPSRetractionLength)
391 FSTRINGVAR(tEPROPSRetractionBacklash)
392 FSTRINGVAR(tEPRBedHeatManager)
393 FSTRINGVAR(tEPRBedPIDDriveMax)
394 FSTRINGVAR(tEPRBedPIDDriveMin)
395 FSTRINGVAR(tEPRBedPGain)
396 FSTRINGVAR(tEPRBedIGain)
397 FSTRINGVAR(tEPRBedDGain)
398 FSTRINGVAR(tEPRBedPISMaxValue)
399 FSTRINGVAR(tEPRStepsPerMM)
400 FSTRINGVAR(tEPRMaxFeedrate)
401 FSTRINGVAR(tEPRStartFeedrate)
402 FSTRINGVAR(tEPRAcceleration)
403 FSTRINGVAR(tEPRHeatManager)
404 FSTRINGVAR(tEPRDriveMax)
405 FSTRINGVAR(tEPRDriveMin)
406 FSTRINGVAR(tEPRPGain)
407 FSTRINGVAR(tEPRDead)
408 FSTRINGVAR(tEPRUnused)
409 FSTRINGVAR(tEPRIGain)
410 FSTRINGVAR(tEPRDGain)
411 FSTRINGVAR(tEPRPIDMaxValue)
412 FSTRINGVAR(tEPRXOffset)
413 FSTRINGVAR(tEPRYOffset)
414 FSTRINGVAR(tEPRZOffset)
415 FSTRINGVAR(tEPRStabilizeTime)
416 FSTRINGVAR(tEPRRetractionWhenHeating)
417 FSTRINGVAR(tEPRDistanceRetractHeating)
418 FSTRINGVAR(tEPRExtruderCoolerSpeed)
419 FSTRINGVAR(tEPRAdvanceK)
420 FSTRINGVAR(tEPRAdvanceL)
421 FSTRINGVAR(tEPRPreheatTemp)
422 FSTRINGVAR(tEPRPreheatBedTemp)
423 #endif
424 #if SDSUPPORT
425 //FSTRINGVAR(tSDRemoved)
426 //FSTRINGVAR(tSDInserted)
427 FSTRINGVAR(tSDInitFail)
428 FSTRINGVAR(tErrorWritingToFile)
429 FSTRINGVAR(tBeginFileList)
430 FSTRINGVAR(tEndFileList)
431 FSTRINGVAR(tFileOpened)
432 FSTRINGVAR(tSpaceSizeColon)
433 FSTRINGVAR(tFileSelected)
434 FSTRINGVAR(tFileOpenFailed)
435 FSTRINGVAR(tSDPrintingByte)
436 FSTRINGVAR(tNotSDPrinting)
437 FSTRINGVAR(tOpenFailedFile)
438 FSTRINGVAR(tWritingToFile)
439 FSTRINGVAR(tDoneSavingFile)
440 FSTRINGVAR(tFileDeleted)
441 FSTRINGVAR(tDeletionFailed)
442 FSTRINGVAR(tDirectoryCreated)
443 FSTRINGVAR(tCreationFailed)
444 FSTRINGVAR(tSDErrorCode)
445 #endif // SDSUPPORT
446 FSTRINGVAR(tHeaterDecoupled)
447 FSTRINGVAR(tHeaterDecoupledWarning)
448 #if DISTORTION_CORRECTION
449 FSTRINGVAR(tZCorrectionEnabled)
450 FSTRINGVAR(tZCorrectionDisabled)
451 #endif
452 #if FEATURE_RETRACTION
453 FSTRINGVAR(tEPRAutoretractEnabled)
454 FSTRINGVAR(tEPRRetractionLength)
455 FSTRINGVAR(tEPRRetractionLongLength)
456 FSTRINGVAR(tEPRRetractionSpeed)
457 FSTRINGVAR(tEPRRetractionZLift)
458 FSTRINGVAR(tEPRRetractionUndoExtraLength)
459 FSTRINGVAR(tEPRRetractionUndoExtraLongLength)
460 FSTRINGVAR(tEPRRetractionUndoSpeed)
461 #endif
462 FSTRINGVAR(tConfig)
463 FSTRINGVAR(tExtrDot)
464 
465 #if STEPPER_CURRENT_CONTROL == CURRENT_CONTROL_MCP4728
466 FSTRINGVAR(tMCPEpromSettings)
467 FSTRINGVAR(tMCPCurrentSettings)
468 #endif
469 FSTRINGVAR(tPrinterModeFFF)
470 FSTRINGVAR(tPrinterModeLaser)
471 FSTRINGVAR(tPrinterModeCNC)
472 #ifdef STARTUP_GCODE
473 FSTRINGVAR(tStartupGCode)
474 #endif
475 #if NONLINEAR_SYSTEM
476 FSTRINGVAR(tEPRSegmentsPerSecondPrint)
477 FSTRINGVAR(tEPRSegmentsPerSecondTravel)
478 #endif
479 
480 static void cap(FSTRINGPARAM(text));
481 static void config(FSTRINGPARAM(text));
482 static void config(FSTRINGPARAM(text),int value);
483 static void config(FSTRINGPARAM(text),const char *msg);
484 static void config(FSTRINGPARAM(text),int32_t value);
485 static void config(FSTRINGPARAM(text),uint32_t value);
486 static void config(FSTRINGPARAM(text),float value,uint8_t digits=2);
487 static void printNumber(uint32_t n);
488 static void printWarningF(FSTRINGPARAM(text));
489 static void printInfoF(FSTRINGPARAM(text));
490 static void printErrorF(FSTRINGPARAM(text));
491 static void printWarningFLN(FSTRINGPARAM(text));
492 static void printInfoFLN(FSTRINGPARAM(text));
493 static void printErrorFLN(FSTRINGPARAM(text));
494 static void printFLN(FSTRINGPARAM(text));
495 static void printF(FSTRINGPARAM(text));
496 static void printF(FSTRINGPARAM(text),int value);
497 static void printF(FSTRINGPARAM(text),const char *msg);
498 static void printF(FSTRINGPARAM(text),int32_t value);
499 static void printF(FSTRINGPARAM(text),uint32_t value);
500 static void printF(FSTRINGPARAM(text),float value,uint8_t digits=2);
501 static void printFLN(FSTRINGPARAM(text),int value);
502 static void printFLN(FSTRINGPARAM(text),int32_t value);
503 static void printFLN(FSTRINGPARAM(text),uint32_t value);
504 static void printFLN(FSTRINGPARAM(text),const char *msg);
505 static void printFLN(FSTRINGPARAM(text),float value,uint8_t digits=2);
506 static void printArrayFLN(FSTRINGPARAM(text),float *arr,uint8_t n=4,uint8_t digits=2);
507 static void printArrayFLN(FSTRINGPARAM(text),long *arr,uint8_t n=4);
508 static void print(long value);
509 static inline void print(uint32_t value) {printNumber(value);}
510 static inline void print(int value) {print((int32_t)value);}
511 static void print(const char *text);
512 static inline void print(char c) {GCodeSource::writeToAll(c);}
513 static void printFloat(float number, uint8_t digits);
514 static inline void print(float number) {printFloat(number, 6);}
515 static inline void println() {GCodeSource::writeToAll('\r');GCodeSource::writeToAll('\n');}
516 static bool writeToAll;
517 #if FEATURE_CONTROLLER != NO_CONTROLLER
518 static const char* translatedF(int textId);
519 static void selectLanguage(fast8_t lang);
520 static uint8_t selectedLanguage;
521 #endif
522  protected:
523  private:
524 };
525 
526 #ifdef DEBUG
527 #define SHOW(x) {Com::printF(PSTR(" " #x "=")); Com::print(x); Com::println();}
528 #define SHOWS(x) {Com::printF(PSTR(" " #x "=")); Com::print(x); Com::print(" steps "); Com::print(x/80); Com::printFLN(PSTR(" mm"));}
529 #define SHOWM(x) {Com::printF(PSTR(" " #x "=")); Com::print((long)x*80); Com::print(" steps "); Com::print(x); Com::printFLN(PSTR(" mm"));}
530 #define SHOT(x) Com::printF(PSTR(x " "))
531 #define SHOWA(t,a,n) {SHOT(t); for (int i=0;i<n;i++) SHOWS(a[i]);}
532 #define SHOWAM(t,a,n) {SHOT(t); for (int i=0;i<n;i++) SHOWM(a[i]);}
533 
534 #else
535 #define SHOW(x)
536 #define SHOT(x)
537 #define SHOWS(x)
538 #define SHOWM(x)
539 #define SHOWA(t,a,n)
540 #define SHOWAM(t,a,n)
541 #endif
542 
543 #endif // COMMUNICATION_H
#define FSTRINGVAR(var)
Definition: HAL.h:52
int8_t waitingForResend
Waiting for line to be resend. -1 = no wait.
Definition: Communication.h:56
static void writeToAll(uint8_t byte)
Write to all listening sources.
Definition: gcode.cpp:1392
static GCodeSource * activeSource
Definition: Communication.h:46
uint32_t lastLineNumber
Definition: Communication.h:53
virtual bool isOpen()=0
#define MAX_DATA_SOURCES
Definition: Communication.h:26
static fast8_t numSources
Number of data sources available.
Definition: Communication.h:41
Definition: Communication.h:40
millis_t timeOfLastDataPacket
Definition: Communication.h:55
static void printAllFLN(FSTRINGPARAM(text))
Definition: gcode.cpp:1407
static void print(char c)
Definition: Communication.h:512
static void println()
Definition: Communication.h:515
virtual void writeByte(uint8_t byte)=0
static fast8_t numWriteSources
Definition: Communication.h:42
static void removeSource(GCodeSource *delSource)
Definition: gcode.cpp:1352
uint32_t millis_t
Definition: HAL.h:158
static void print(int value)
Definition: Communication.h:510
static bool writeToAll
Definition: Communication.h:516
virtual bool closeOnError()=0
static void print(uint32_t value)
Definition: Communication.h:509
static void registerSource(GCodeSource *newSource)
Definition: gcode.cpp:1340
int8_t fast8_t
Definition: HAL.h:160
virtual ~GCodeSource()
Definition: Communication.h:59
virtual bool dataAvailable()=0
GCodeSource()
Definition: gcode.cpp:1421
static GCodeSource * writeableSources[MAX_DATA_SOURCES]
Definition: Communication.h:44
virtual int readByte()=0
static GCodeSource * sources[MAX_DATA_SOURCES]
Definition: Communication.h:43
static void print(float number)
Definition: Communication.h:514
#define FSTRINGPARAM(var)
Definition: HAL.h:53
static void rotateSource()
Move active to next source.
Definition: gcode.cpp:1371
uint8_t wasLastCommandReceivedAsBinary
Was the last successful command in binary mode?
Definition: Communication.h:54
virtual void close()=0
Definition: Communication.h:69
virtual bool supportsWrite()=0
true if write is a non dummy function